/////////////////////////////////////////////////////////////////////////
//
// Amuse Engine SDK - system
// Copyright( c) 2015.  All Rights Reserved
//
// File:		AEUserDataObj.h
// Author:		Gianluca Belardelli
// Date:		11/02/2015
//
/////////////////////////////////////////////////////////////////////////
#ifndef _AEUSERDATAOBJ_H_
#define _AEUSERDATAOBJ_H_

/// \brief
///   Simple inlined class that provides GetUserData and SetUserData function for attaching a user
///   data pointer.
class AEUserDataObj
{
protected:
	void 	*m_lpUserData;
  
public:
	/// \brief
	///   Constructor; initializes the user data pointer to \c NULL.
	AE_FORCEINLINE AEUserDataObj( void );
	
	/// \brief
	///   Destructor.
	/// \note
	///   The destructor does \b not free the user data object!
	AE_FORCEINLINE virtual ~AEUserDataObj( void );
	
	/// \brief
	///   Returns the custom user data pointer
	/// 
	///  The custom user data pointer can be used by the game programmer to attach data to an engine
	/// object. The engine initialises this pointer with NULL in the constructor of the object, it
	/// does neither use the pointer during the game nor free it when the object gets deleted.
	/// 
	/// \return
	///   void *pUserData : pointer to the custom user defined data
	AE_FORCEINLINE void *GetUserData( void ) const;
	
	/// \brief
	///   Sets the custom user data pointer
	/// 
	///  The custom user data pointer can be used by the game programmer to attach data to an engine
	/// object. The constructor initializes this pointer with NULL. The user data is neither used nor
	/// free'd by the engine.
	/// 
	/// User data pointers will also not be serialized. Instead, the pointer is initialized with NULL
	/// for any deserialized object, so the user is responsible for reassigning this pointer
	/// 
	/// \param pData
	///   custom user defined data pointer
	AE_FORCEINLINE void SetUserData( void *lpData );
};

#include "AEUserDataObj.inl"

#endif // _AEUSERDATAOBJ_H_
